<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Gym Rat | New Log Entry</title>
<style type="text/css">
@import "${pageContext.request.contextPath}/js/jquery.datepick.css";
</style>
<script type="text/javascript"
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery.datepick.js"></script>
<script type="text/javascript">
$(function() {
	$('#popupDatepicker').datepick();
});
</script>
</head>
<body>
<jsp:include page="/includes/nav.jsp" />

<h1>Adding log entry for ${routine.name}</h1>
<ul>
	<li>Select the Variation and Equipment used for each exercise</li>
	<li>Variation you want not available? You will have to edit the
	routine entry.</li>
	<li>Equipment you want not available? You will have to edit the
	exercise, if you have permission</li>
	<li>Leave boxes empty if you skip sets, <i><del>click
	"Add Set" to do another</del></i>.
</ul>
<h1>Date Worked</h1>

<form action="submitEntry" method="post"><input type="text"
	name="date" id="popupDatepicker"> <c:forEach
	items="${routine.entries}" var="entry">
	<input type="hidden" name="routineid" value="${routine.id }" />


	<h2>${entry.order}) ${entry.exercise }</h2>

	<p>${entry.note }</p>

	<table>
		<tr>
			<td>Variation:</td>
			<td><select name="variation_${entry.id}">
				<c:forEach items="${entry.variations }" var="variation">
					<option value="${variation.key }">${variation.value }</option>
				</c:forEach>
			</select></td>
			<td>Equipment:</td>
			<td><select name="equipment_${entry.id}">
				<c:forEach items="${entryEquip[entry.id] }" var="equip">
					<option value="${equip.id }">${equip.name }</option>
				</c:forEach>
			</select></td>
		</tr>
	</table>
	<table>
		<tr>
			<td>Set:</td>
			<td>Reps:</td>
			<td>Weight:</td>
		</tr>
		<c:forEach var="i" begin="1" end="${entry.sets }" step="1">
			<tr>
				<td>${i }</td>
				<td><input type="text" size="3" name="reps_${entry.id }"></td>
				<td><input type="text" size="3" name="weight_${entry.id }"></td>
			</tr>
		</c:forEach>
		<tr>
			<td colspan="2"><input type="button" value="Add Set"
				disabled="disabled" /></td>
		</tr>
	</table>

</c:forEach><input type="submit" /></form>
</body>
</html>